<template>
	<view :class="[config.style]">
		<view class="weixin">
			<view class="style1">
				<view class="info">
					<view class="logo">
						<image mode="widthFix" :src="config.config.share.icon" @error="imageError" class="image"></image>
					</view>
					<view class="content">
						<view class="title text-ellipsis">{{config.config.follow.title}}</view>
						<view class="desc text-ellipsis-2">{{config.config.follow.desc}}</view>
					</view>
				</view>
				<view class="button">
					<button type="default" class="follow-btn" @click="followWechat">关注公众号</button>
				</view>
			</view>
		</view>
		
		<!--关注公众号popup弹窗-->
		<uni-popup ref="openDetail" type="center">
			<view class="open-detail">
				<!--图片类型公告-->
				<view class="open-detail-item type-image">
					<view class="qrcode-image">
						<image class="image" :src="config.config.follow.qrcode_url"></image>
						<view class="title">
							长按识别二维码
						</view>
					</view>
					<view class="close-icon" @click="close()">
						<text class="iconfont">&#xe622;</text>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>

	export default {
		name: 'Weixin',
		props: {
			title: {
				type: String,
				default: '关注公众号'
			},
			thisStyle: {
				type: Number,
				default: 1
			},
			type: {
				type: String,
				default: 'weixin',
			},
			config: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				
			}
		},
		created() {
			
		},
		methods: {
			/**
			 * 关注公众号
			 */
			followWechat: function(){
				this.$refs.openDetail.open()
			},
			close: function(){
				this.$refs.openDetail.close()
			},
		}
	}
</script>

<style lang="scss">
	.weixin {
		margin: 20rpx;
		.style1 {
			.info {
				display: flex;
				flex-wrap: wrap;
				.logo {
					width: 120rpx;
					.image {
						width: 100%;
						border-radius: 10rpx;
						display: block;
					}
				}
				.content {
					flex: 1;
					margin-left: 20rpx;
					.title {
						font-size: 28rpx;
					}
					.desc {
						font-size: 24rpx;
						line-height: 36rpx;
						color: #999;
					}
				}
			}
			.button {
				margin: 10rpx 0;
				.follow-btn {
					font-size: 28rpx;
					color: #fff;
					
				}
			}
		}
	}
	.open-detail {
		.open-detail-item {
			
			padding: 20rpx;
			border-radius: 10rpx;
			.qrcode-image {
				background-color: #fff;
				padding: 20rpx;
				.image {
					width: 500rpx;
					height: 500rpx;
				}
				.title {
					text-align: center;
					font-size: 30rpx;
					color: #999;
					padding: 20rpx 0;
				}
			}
		}
		
		.close-icon {
			padding-top: 32rpx;
			text-align: center;
			color: #fff;
			.iconfont {
				font-size: 64rpx;
			}
		}
	}
	/*页面风格设计*/
	.Blue {
		.weixin {
			.follow-btn {
				background-color: $Blue;
			}
			.follow-btn:active {
				background-color: $Blue-hover;
			}
		}
	}
	.Green {
		.weixin {
			.follow-btn {
				background-color: $Green;
			}
			.follow-btn:active {
				background-color: $Green-hover;
			}
		}
	}
	.LightRed {
		.weixin {
			.follow-btn {
				background-color: $LightRed;
			}
			.follow-btn:active {
				background-color: $LightRed-hover;
			}
		}
	}
	.Orange {
		.weixin {
			.follow-btn {
				background-color: $Orange;
			}
			.follow-btn:active {
				background-color: $Orange-hover;
			}
		}
	}
	.LightPink {
		.weixin {
			.follow-btn {
				background-color: $LightPink;
			}
			.follow-btn:active {
				background-color: $LightPink-hover;
			}
		}
	}
	.Magenta {
		.weixin {
			.follow-btn {
				background-color: $Magenta;
			}
			.follow-btn:active {
				background-color: $Magenta-hover;
			}
		}
	}
</style>
